package com.xuan.yupao.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xuan.yupao.model.domain.User;
import com.xuan.yupao.model.domain.request.UserUpdatePasswordRequest;
import com.xuan.yupao.model.domain.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;

/**
* @author 清凉茶
* @description 针对表【user】的数据库操作Service
* @createDate 2024-04-24 20:47:24
*/
public interface UserService extends IService<User> {


    long userRegister(String userAccount, String password, String checkPassword, HttpServletRequest request);

    Long userLogin(String userAccount, String userPassword, HttpServletRequest request);


    UserVo getSafetyUser(User user);


    List<UserVo> searchUsers(String username, HttpSession session);

    boolean deleteUser(Integer id, HttpSession session);

    List<UserVo> searchUsersByTagNameList(List<String> tagNameList, int pageNum, User loginUser);

    Integer updateUser(User user, User loginUser);


    boolean isAdmin(User user);

    /**
     *  随机推荐用户
     * @param pageNum 分页查询页数
     * @param username 搜索的用户名关键词
     * @param loginUser
     * @return
     */
    List<UserVo> recommendUsers(int pageNum, String username, User loginUser);

    User getLoginUser(HttpServletRequest request);

    List<UserVo> matchUsersByHeap(int pageNum, String username, User loginUser);

    List<UserVo> matchUserByQuickSort(int pageNum, String username, User loginUser);

    /**
     * 根据 useId 获取用户信息(包括是否关注和是否为好友)
     * 允许用户未登录
     * @param userId
     * @param loginUser
     * @return
     */
    UserVo getUserVoById(Long userId, User loginUser);

    /**
     * 用户修改密码
     * @param updatePasswordRequest
     * @param loginUser
     * @return
     */
    boolean updatePassword(UserUpdatePasswordRequest updatePasswordRequest, User loginUser);
}
